
#include "comm/thread.h"


#ifdef WIN32


#else

#include "pthread.h"

int mutex_init(mutex_t *mutex)
{
	return pthread_mutex_init(mutex, NULL);
}

int mutex_destroy(mutex_t *mutex)
{
	return pthread_mutex_destroy(mutex);
}

int mutex_lock(mutex_t *mutex)
{
	return pthread_mutex_lock(mutex);
}

int mutex_trylock(mutex_t *mutex)
{
	return pthread_mutex_trylock(mutex);
}

int mutex_unlock(mutex_t *mutex)
{
	return pthread_mutex_unlock(mutex);
}

/**********************************
 *
 */

int thread_create(thread_t *thread, thread_fn_t pfn)
{
	return pthread_create(thread, NULL, pfn, NULL);
}

int thread_destroy(thread_t *thread)
{
	//return pthread_kill(thread);
}


/**********************************
 *
 */

int ssem_init(ssem_t *sem)
{
	return sem_init(sem, 0, 0);
}

int ssem_post(ssem_t *sem)
{
	return sem_post(sem);
}


int ssem_wait(ssem_t *sem)
{
	return sem_wait(sem);
}

int ssem_destroy(ssem_t *sem)
{
	return sem_destroy(sem);
}


#endif
